/**
  对象本身的两个方法
    * get propertyName(){} 用来得到当前属性值的回调函数
    * set propertyName(){} 用来监视当前属性值变化的回调函数
*/
var obj = {
  firstname: 'LeBron',
  lastname: 'James',
  get fullname() {
    return this.firstname + ' ' + this.lastname
  },
  set fullname(val) {
    var names = val.split(' ')
    this.firstname = names[0]
    this.lastname = names[1]
  }
}

console.log(obj.fullname)

obj.fullname = 'Limi Pan'
console.log(obj.fullname)
console.log(obj.firstname)
console.log(obj.lastname)